'''
BM13 判断一个链表是否为回文结构
'''

class ListNode:
    def __init__(self,val,next=None):
        self.val = val
        self.next = next


class Solution:
    def isPail(self , head: ListNode) -> bool:
        if head == None:
            return False
        list = []

        while head:
            list.append(head.val)
            head = head.next

        temp = list
        temp.reverse()

        for i in range(len(list)):
            if list[i] != temp[i]:
                return False
        return True

